﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControl_ImgUploader : System.Web.UI.UserControl
{
    #region 上传按钮
    private int _Height;
    /// <summary>
    /// 上传按钮的高度
    /// </summary>
    public int Height
    {
        get { return _Height; }
        set { _Height = value; }
    }
    private string _ButtonImg;
    /// <summary>
    /// Uploadify上传按钮的图片路径，可为空。（不支持~，只支持../）
    /// </summary>
    public string ButtonImg
    {
        get { return _ButtonImg; }
        set { _ButtonImg = value; }
    } 
    #endregion
    #region 路径设置
    /// <summary>
    /// 要显示的图片的路径（相对于此控件，而不是调用的页面。）
    /// </summary>
    public string ImageURL
    {
        set { imgImage.ImageUrl = value; }
    }
    private string _UploadifyFolder;
    /// <summary>
    /// Uploadify插件所在的目录（不支持~，只支持../）
    /// </summary>
    public string UploadifyFolder
    {
        get { return _UploadifyFolder; }
        set { _UploadifyFolder = value; }
    }
    private string _ImgFolder;
    /// <summary>
    /// 上传后图片所在的文件夹（不支持~，只支持../）
    /// </summary>
    public string ImgFolder
    {
        get { return _ImgFolder; }
        set { _ImgFolder = value; }
    }
    private string _HanderPath;
    /// <summary>
    /// 接收上传的服务器端接口地址（不支持~，只支持../）
    /// </summary>
    public string HanderPath
    {
        get { return _HanderPath; }
        set { _HanderPath = value; }
    } 
    #endregion
    private bool _IsMulti = false;
    /// <summary>
    /// 是否支持多文件选择
    /// </summary>
    public bool IsMulti
    {
        get { return _IsMulti; }
        set { _IsMulti = value; }
    }
    /// <summary>
    /// 是否已上传
    /// </summary>
    public bool IsUploaded
    {
        get { return string.IsNullOrEmpty(imgImage.ImageUrl) ? false : true; }
    }
    /// <summary>
    /// 获取当前图片的文件名（仅名称，不带路径。）
    /// </summary>
    public string ImageName
    {
        get
        {
            if (string.IsNullOrEmpty(imgImage.ImageUrl))
            {
                return string.Empty;
            }
            return imgImage.ImageUrl.Substring(imgImage.ImageUrl.LastIndexOf("\\") + 1); ;
        }
    }
}
